package com.cjack.frenchexcel.response;

import com.cjack.frenchexcel.model.AdminUserModel;
import com.cjack.frenchexcel.util.ModelUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@ApiModel( value="用户信息", description= "用户信息" )
@Data
public class AppUserModel implements Serializable {

    @ApiModelProperty( "用户id")
    private Long appUserId;
    @ApiModelProperty( "用户头像")
    private String headImg;
    @ApiModelProperty( "员工工号")
    private String jobNumber;
    @ApiModelProperty( "电话")
    private String phone;
    @ApiModelProperty( "员工姓")
    private String nom;
    @ApiModelProperty( "员工名")
    private String prenom;
    @ApiModelProperty( "邮箱")
    private String email;
    @ApiModelProperty( "员工积分")
    private Integer integral;
    @ApiModelProperty( "员工角色id")
    private Long roleId;
    @ApiModelProperty( "员工角色名称")
    private String roleName;

    public static AppUserModel sourceFrom(AdminUserModel model){
        AppUserModel appUserModel = ModelUtils.copySignModel( model, AppUserModel.class);
        appUserModel.setAppUserId( model.getId());
        appUserModel.setRoleId( model.getRole().getId());
        appUserModel.setRoleName( model.getRole().getRoleName());
        appUserModel.setNom( model.getNom() + model.getNomNumber());
        return appUserModel;
    }
}
